home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / FATAL.H < prev    next >
Text File  |  1988-05-30  |  2KB  |  82 lines

  1. /* -*-C-*- fatal.h */
  2. /*-->fatal*/
  3. /**********************************************************************/
  4. /******************************* fatal ********************************/
  5. /**********************************************************************/
  6.  
  7. void
  8. fatal(msg)                /* issue a fatal error message */
  9. char *msg;                /* message string */
  10. {
  11.     if (g_dolog && (g_logfp == (FILE *)NULL) && g_logname[0])
  12.     {
  13.     g_logfp = fopen(g_logname,"w+");
  14.     DEBUG_OPEN(g_logfp,g_logname,"w+");
  15.     if (g_logfp == (FILE *)NULL)
  16.     {
  17.         (void)fprintf(stderr,"Cannot open log file [%s]",g_logname);
  18.         NEWLINE(stderr);
  19.     }
  20.     else
  21.     {
  22.         (void)fprintf(stderr,"[Log file [%s] created]",g_logname);
  23.         NEWLINE(stderr);
  24.  
  25. #if    OS_TOPS20
  26. #if    PCC_20
  27.         /* Because of the PCC-20 arithmetic (instead of */
  28.         /* logical) shift bug wherein a constant expression */
  29.         /* (1<<35) evaluates to 0 instead of 400000,,000000, */
  30.         /* we must set CF_nud using a variable, instead of */
  31.         /* just using a constant "ac1 = makefield(CF_nud,1);" */
  32.         ac1 = 1;
  33.         ac1 = makefield(CF_nud,ac1);
  34.         setfield(ac1,CF_jfn,jfnof(fileno(g_logfp)));    /* jfn */
  35.         setfield(ac1,CF_dsp,FBbyv);    /* generation number index in fdb */
  36.         ac2 = makefield(FB_ret,-1);
  37.         ac3 = makefield(FB_ret,0);/* set generation count to 0 (infinite) */
  38.         (void)jsys(JSchfdb,acs);    /* ignore any errors */
  39. #endif /* PCC_20 */
  40. #endif
  41.  
  42.     }
  43.     }
  44.     if (g_dolog && (g_logfp != (FILE *)NULL) && g_logname[0])
  45.     {
  46.     NEWLINE(g_logfp);
  47.  
  48. #if    (OS_TOPS20 | OS_VAXVMS)
  49.     (void)putc('?',g_logfp);        /* query at start of line */
  50. #endif
  51.  
  52.     (void)fputs(g_progname,g_logfp);
  53.     (void)fputs(": FATAL--",g_logfp);
  54.     (void)fputs(msg,g_logfp);
  55.     NEWLINE(g_logfp);
  56.     (void)fprintf(g_logfp,"Current TeX page counters: [%s]",tctos());
  57.     NEWLINE(g_logfp);
  58.     }
  59.  
  60. #if    BBNBITGRAPH
  61.     rsetterm();
  62. #endif
  63.  
  64.     NEWLINE(stderr);
  65.  
  66. #if    (OS_TOPS20 | OS_VAXVMS)
  67.     (void)putc('?',stderr);        /* query at start of line */
  68. #endif
  69.  
  70.     (void)fputs(g_progname,stderr);
  71.     (void)fputs(": FATAL--",stderr);
  72.     (void)fputs(msg,stderr);
  73.     NEWLINE(stderr);
  74.     (void)fprintf(stderr,"Current TeX page counters: [%s]",tctos());
  75.     NEWLINE(stderr);
  76.     NEWLINE(stderr);
  77.  
  78.     g_errenc = 1;            /* set global fatal exit code */
  79.     alldone();
  80. }
  81.  
  82.